# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Monitoring.V3.Model.ServiceLevelObjective do
  @moduledoc """
  A Service-Level Objective (SLO) describes a level of desired good service. It consists of a service-level indicator (SLI), a performance goal, and a period over which the objective is to be evaluated against that goal. The SLO can use SLIs defined in a number of different manners. Typical SLOs might include "99% of requests in each rolling week have latency below 200 milliseconds" or "99.5% of requests in each calendar month return successfully."

  ## Attributes

  *   `calendarPeriod` (*type:* `String.t`, *default:* `nil`) - A calendar period, semantically "since the start of the current ". At this time, only DAY, WEEK, FORTNIGHT, and MONTH are supported.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Name used for UI elements listing this SLO.
  *   `goal` (*type:* `float()`, *default:* `nil`) - The fraction of service that must be good in order for this objective to be met. 0 < goal <= 0.9999.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Identifier. Resource name for this ServiceLevelObjective. The format is: projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] 
  *   `rollingPeriod` (*type:* `String.t`, *default:* `nil`) - A rolling time period, semantically "in the past ". Must be an integer multiple of 1 day no larger than 30 days.
  *   `serviceLevelIndicator` (*type:* `GoogleApi.Monitoring.V3.Model.ServiceLevelIndicator.t`, *default:* `nil`) - The definition of good service, used to measure and calculate the quality of the Service's performance with respect to a single aspect of service quality.
  *   `userLabels` (*type:* `map()`, *default:* `nil`) - Labels which have been used to annotate the service-level objective. Label keys must start with a letter. Label keys and values may contain lowercase letters, numbers, underscores, and dashes. Label keys and values have a maximum length of 63 characters, and must be less than 128 bytes in size. Up to 64 label entries may be stored. For labels which do not have a semantic value, the empty string may be supplied for the label value.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :calendarPeriod => String.t() | nil,
          :displayName => String.t() | nil,
          :goal => float() | nil,
          :name => String.t() | nil,
          :rollingPeriod => String.t() | nil,
          :serviceLevelIndicator => GoogleApi.Monitoring.V3.Model.ServiceLevelIndicator.t() | nil,
          :userLabels => map() | nil
        }

  field(:calendarPeriod)
  field(:displayName)
  field(:goal)
  field(:name)
  field(:rollingPeriod)
  field(:serviceLevelIndicator, as: GoogleApi.Monitoring.V3.Model.ServiceLevelIndicator)
  field(:userLabels, type: :map)
end

defimpl Poison.Decoder, for: GoogleApi.Monitoring.V3.Model.ServiceLevelObjective do
  def decode(value, options) do
    GoogleApi.Monitoring.V3.Model.ServiceLevelObjective.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Monitoring.V3.Model.ServiceLevelObjective do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
